package com.buddies.lottery.ui.lottery.bet;

import com.buddies.lottery.base.BasePresenter;
import com.buddies.lottery.data.BaseObserver;
import com.buddies.lottery.data.DataManager;
import com.buddies.lottery.data.bean.LotteryBetRecord;
import com.buddies.lottery.data.result.PageResult;

import java.util.Map;

public class LotteryBetRecordPresenter extends BasePresenter<LotteryBetRecordContract.View> implements LotteryBetRecordContract.Presenter {

    public LotteryBetRecordPresenter(LotteryBetRecordContract.View view) {
        super(view);
    }

    @Override
    public void loadLotteryBetRecord(Map<String, Object> params, int page) {
        addSubscription(DataManager.getInstance().getLotteryRepo().getLotteryBetRecord(params, page), new BaseObserver<PageResult<LotteryBetRecord>>() {
            @Override
            public void onNext(PageResult<LotteryBetRecord> response) {
                mView.onLotteryBetRecordLoaded(response);
            }

            @Override
            public void onError(Throwable e) {
                mView.onError(e);
            }
        });
    }

}
